import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
//导入element-plus框架
import ElementPlus from 'element-plus'
import 'element-plus/theme-chalk/index.css'

import 'font-awesome/css/font-awesome.min.css'

router.beforeEach((to, from, next) => {
    const url = to.path;
    if (!(url === '/login' || url === '/register')){
        if (!sessionStorage.getItem('user')){
            router.push('/login')
        }
    }
    next();
})

createApp(App).use(router).use(ElementPlus).mount('#app')
